#ifndef __ARCHIVES_H__
#define __ARCHIVES_H__

#include "cocos2d.h"
#include "Player.h"


class Archives
{
public:
	Archives();
	~Archives();


	static Archives* sharedArchives();

	bool IsExistAndCanUseArchives();



private:
	static Archives* m_pArchives;

	class CGarbo
	{
	public:
		~CGarbo()
		{
			if (Archives::m_pArchives != NULL)
			{
				delete Archives::m_pArchives;
			}
		}
	};

	static CGarbo m_garbo;

public:
	void GetPlayer_Property(Player& var);
	void SetPlayer_Property(const Player& Data);

	std::string GetPlayerPassword()				   { return CCUserDefault::sharedUserDefault()->getStringForKey("Player_Password");			}
	std::string GetPlayerAccount()				   { return CCUserDefault::sharedUserDefault()->getStringForKey("Player_Account");			}
	std::string GetPlayer_Name()				   { return CCUserDefault::sharedUserDefault()->getStringForKey("Player_Name");				}
	uint16 GetPlayer_Level()					   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_Level");			}
	uint32 GetPlayer_Diamond()					   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_Diamond");			}
	uint32 GetPlayer_Exp()						   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_Exp");				}
	uint32 GetPlayer_CurrLevelMaxExp()			   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_CurLevelMaxExp");	}
	uint32 GetPlayer_Strength()					   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_Strangth");		}
	uint64 GetPlayer_Money()					   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_Money");			}
	uint32 GetPlayer_LeaderShip()				   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_LeaderShip");		}
	uint32 GetPlayer_TeamLevel()				   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_TeamLevel");		}
	uint32 GetPlayer_PvpRank()					   { return CCUserDefault::sharedUserDefault()->getIntegerForKey("Player_PVPRank");			}


	void SetPlayerPassword(std::string var)			{ CCUserDefault::sharedUserDefault()->setStringForKey("password", var);					CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayerAccount(std::string var)			{ CCUserDefault::sharedUserDefault()->setStringForKey("account", var);					CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_Name(std::string var)			{ CCUserDefault::sharedUserDefault()->setStringForKey("Player_Name", "null");			CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_Level(uint16& var)				{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_Level", var);			CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_Diamond(uint32& var)				{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_Diamond", var);			CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_Exp(uint32& var)					{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_Exp", var);				CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_CurLevelMaxExp(uint32& var)		{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_CurLevelMaxExp", var);	CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_Strength(uint32& var)			{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_Strangth", var);			CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_Money(uint64& var)				{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_Money", var);			CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_LeaderShip(uint64& var)			{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_LeaderShip", var);		CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_TeamLevel(uint32& var)			{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_TeamLevel", var);		CCUserDefault::sharedUserDefault()->flush(); }
	void SetPlayer_PvpRank(uint32& var)				{ CCUserDefault::sharedUserDefault()->setIntegerForKey("Player_PVPRank", var);			CCUserDefault::sharedUserDefault()->flush(); }





};



#endif